package com.example.project10;

import android.provider.BaseColumns;

/**
 * 数据库契约类
 * 集中定义数据库的表名、列名等常量
 */
public final class DatabaseContract {
    // 私有构造函数，防止被意外实例化
    private DatabaseContract() {}

    /**
     * Book表的定义
     */
    public static class BookEntry implements BaseColumns {
        public static final String TABLE_BOOKS = "books";
        
        // 列名
        public static final String COLUMN_ID = "id";
        public static final String COLUMN_BOOK_NUMBER = "book_number";
        public static final String COLUMN_BOOK_NAME = "book_name";
        public static final String COLUMN_USER_EMAIL = "user_email";

        // 创建表的SQL语句
        public static final String CREATE_TABLE_BOOKS =
            "CREATE TABLE " + TABLE_BOOKS + " (" +
            COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
            COLUMN_BOOK_NUMBER + " TEXT NOT NULL, " +
            COLUMN_BOOK_NAME + " TEXT NOT NULL, " +
            COLUMN_USER_EMAIL + " TEXT NOT NULL" +
            ")";
    }
}